from xlutils.copy import copy
import xlrd
import os

#打开需要修改的Excel
book = xlrd.open_workbook('test.xls')
#复制一份并在新Excel里写入要修改的数据
new_book = copy(book)
sheet = new_book.get_sheet(0)
sheet.write(1,1,'xiangshang')
#保存新表
new_book.save('newtest.xls')

#导入系统OS模块,删除原来的Excel
os.remove('test.xls')
#把新的Excel的表名改为原来的表名
os.rename('newtest.xls', 'test.xls')

